



* variables for table (must correspond to stored estimates in attenbias_LPs)
set more off
****************************************************************
*** TABLE OLS v IV
****************************************************************
pause on

capture matrix drop b
capture matrix drop se
****** IV
	qui esttab ols0 ols10 ols20 ols30 ols40  , se nostar stats(pval_wars_pandemics N) 
	capture matrix drop C
	matrix C = r(coefs)
	matrix S = r(stats)
	matrix list S
	matrix list C
	
	matrix coleq C = h0 h0 h10 h10 h20 h20 h30 h30 h40 h40
	
	est drop ols0 ols10 ols20 ols30 ols40

	local models : coleq C
	local models : list uniq models
	di "`models'"


	   
	* coefficients for pandemics
	   local k 0
	   capture matrix drop b
	   capture matrix drop se
	   capture matrix drop b_pandemics
	   capture matrix drop se_pandemics
	   foreach model of local models {
			  local ++k
			  matrix tmp = C[1, 2*`k'-1]
			  if tmp[1,1]!=. {
				  matrix colnames tmp = `model'
				  matrix b = nullmat(b), tmp
				  matrix tmp[1,1] = C[1, 2*`k']
				  matrix se = nullmat(se), tmp
				  
				  
			  }
		  }
				  

	matrix b_pandemics = b
	matrix se_pandemics = se
	ereturn post b
	quietly estadd matrix se 
	eststo pandemics

	esttab pandemics
	
	
	* coefficients for wars
	   local k 0
	   capture matrix drop b
	   capture matrix drop se
	   capture matrix drop b_wars
	   capture matrix drop se_wars
	   foreach model of local models {
			  local ++k
			  matrix tmp = C[2, 2*`k'-1]
			  
			  if tmp[1,1]!=. {
				  matrix colnames tmp = `model'
				  matrix b = nullmat(b), tmp
				  matrix tmp[1,1] = C[2, 2*`k']
				  matrix se = nullmat(se), tmp
			  }
		  }
	matrix b_wars  = b
	matrix se_wars = se
	ereturn post b
	quietly estadd matrix se
	eststo wars
	esttab wars
	 
	* Wars = Pandemics p-values
	 local k 0
		capture matrix drop b
		foreach model of local models {
			local ++k
			di "`k'"
			matrix tmp = S[1, `k']
			matrix colnames tmp = `model'
			matrix b = nullmat(b), tmp
         }
    ereturn post b
	eststo pval_test_wp
 
	* stats that are the same for all horizons
	local tmp = S[2,1]
	estadd scalar Obs = `tmp' : pandemics

	mat drop C
	mat drop S
	
	






	 
